<style lang="less" scoped>
.page {
  padding: 3.5rem 2.5rem;
  background-color: #fff;
}

.info {
  font-size: 1.1rem;
  padding: 0rem 2.5rem;
  .avatar {
    width: 10rem;
    height: 10rem;
    margin: 0rem auto;
    margin-bottom: 3rem;
    border-radius: 50%;
    background-color: #fff;
    overflow: hidden;

    img {
      width: 100%;
      height: 100%;
    }
  }
  .tag {
    width: 5rem;
    margin-right: 1rem;
  }
  .content {
    color: #999;
  }
}
</style>
<template>
  <div class="w-100 h-100 bg-white">
    <div class="page d-flex-column">
      <div class="info d-flex-column">
        <div class="avatar">
          <img :src="user.avatar || '~assets/edite-avatar.png'" />
        </div>
        <div style="margin-bottom: 1rem;" class="d-flex-row align-items-center">
          <div class="tag">姓名</div>
          <div class="content w-100">{{user.member.name}}</div>
        </div>
        <div style="margin-bottom: 1rem;" class="d-flex-row align-items-center">
          <div class="tag">部门</div>
          <div class="content w-100">{{user.member.dept.name}}</div>
        </div>
        <!-- <div style="margin-bottom: 1rem;" class="d-flex-row align-items-center">
          <div class="tag">职务</div>
          <div class="content w-100">销售职员</div>
        </div> -->
        <div style="margin-bottom: 1rem;" class="d-flex-row align-items-center">
          <div class="tag">电话</div>
          <div class="content w-100">{{user.mobile}}</div>
        </div>
      </div>
      <div @click="goMine" style="margin-top: 2.5rem;" class="max-button">确定</div>
    </div>
  </div>
</template>
<script>
/**
 * 个人资料
 */
export default {
  name: "editeUser",
  data() {
    return {
      user:{}
    };
  },
  created(){
    this.getMine()
  },
  methods: {
    getMine(){
      this.API.getMemberInfo()
        .then((result) => {
          console.log(result)
          if (result.code > 0) {
            Object.keys(result.data).forEach((key)=>{
              // this.user[key] = result.data[key]
              this.$set(this.user, key, result.data[key])
            })
          } else {
            this.$NotificAtion(result.msg)
            console.error(result)
          }
          
        }).catch((err) => {
          console.log(err)
        });
    },
    goMine() {
      this.$router.push({ name: "mine" });
    }
  }
};
</script>